-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Count downloads for tag archives #25606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This should now be ready to review now. Only think left is Migration, but i will at this at the very least. |
Does nobody want to review this PR? |
Bump |
Bump |
Is nobody interested in this? |
Thanks @JakobDev, sorry this PR fell behind. I'll try to push a migration to this branch later today to complete the TODO list. |
ack, didn't get around to the migration, but was able to resolve the linting issues that the CI was hanging on. |
I have now rewritten the Code to use the Release ID instead of the Tag as suggested by @lunny. I also added a migration and some improvements. I hope this will be merged soon. |
release, err := GetRelease(ctx, repoID, tagName) | ||
if err != nil { | ||
if IsErrReleaseNotExist(err) { | ||
return new(api.TagArchiveDownloadCount), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just return NotExist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just to prevent a error in case this is somehow called with a wrong tag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe returning the 404 error is better because the tag doesn't exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning the error causes problem when a tag exists in git but not in the db.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning the error causes problem when a tag exists in git but not in the db.
That's a problem should be fixed by other PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So should I ignore Not Exists error then? I don't know if this can happen in the real world, but at least the tests are failing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
We currently count the downloads for Release Attachments, which is useful, but not for source archives. This PR changed this. Now downloads for source archives (tags only) are also counted!
TODO:
Reset download count, when tag is deleted (I don't know how to do this, so a help would be appreciated) (Done)Add Migration